package common;

import common.Constants.*;
import common.cell.Player;
import common.cell.Empty;

class Main {
    public var grid: GridImpl;
    public var player: Player;

    public function new(grid: GridImpl) {
        this.grid = grid;

        grid.setCell(10, 10, LAYER_ENTITIES, player = new Player(grid, 10, 10, LAYER_ENTITIES));

        #if cli
            Draw.text(grid, 0, 48, 2, "Health = 3", 0);
        #else
            Draw.text(grid, 0, 48, 2, "♥♥♥", 0);
        #end

        Draw.text(grid, 0, 49, 2, "Hey its me ur grid");
    }

    public function update(key: Int) {
        grid.batch();

        for (layer in grid.tilearr) {
            for (cell in layer) {
                cell.update(key);
            }
        }

        grid.execBatch();
    }
}
